#ifndef Tweet_h
#define Tweet_h

#include <stdexcept>
#include <iostream>

class InvalidUserException : public std::invalid_argument
{
public:
  InvalidUserException(const std::string &user) : std::invalid_argument(user) {}
};

class Tweet
{
public:
  static const std::string NULL_USER;

  Tweet(const std::string &message = "",
        const std::string &user = Tweet::NULL_USER)
      : message_(message), user_(user)
  {
    if (!isValid(user_))
      throw InvalidUserException(user_);
  }

  bool isValid(const std::string &user) const
  {
    return '@' == user[0];
  }

private:
  std::string message_;
  std::string user_;
};

#endif // Tweet_h
